package edu.sctu.alex.June.day20150615;

import java.io.*;

/**
 * Created by alex on 2015/6/15.
 */
public class ByteTest {

    public static void main(String[] args) {

        int ch;

        FileInputStream  fileInputStream ;
        FileOutputStream fileOutputStream;

        byte[] buffer = new byte[1024];

        try {
            fileInputStream = new FileInputStream(new File("F:\\alex/yangxu.txt"));
            fileOutputStream = new FileOutputStream(new File("F:\\alex/yangxu1.txt"));

            try {
                while ((ch=fileInputStream.read(buffer))!=-1){
                     fileOutputStream.write(buffer,0,ch);

                }
                for (int i = 0; i <buffer.length ; i++) {
                    if(buffer[i]!= 0){

                        System.out.println(buffer[i]);
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}
